package com.ruoyi.supermarket.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.supermarket.mapper.UserCollectionMapper;
import com.ruoyi.supermarket.domain.UserCollection;
import com.ruoyi.supermarket.service.UserCollectionService;

/**
 * 用户收藏Service业务层处理
 * 
 * @author 李其伟
 * @date 2023-08-14
 */
@Service
public class UserCollectionServiceImpl implements UserCollectionService
{
    @Autowired
    private UserCollectionMapper userCollectionMapper;

    /**
     * 查询用户收藏
     * 
     * @param id 用户收藏主键
     * @return 用户收藏
     */
    @Override
    public UserCollection selectUserCollectionById(Long id)
    {
        return userCollectionMapper.selectUserCollectionById(id);
    }

    /**
     * 查询用户收藏列表
     * 
     * @param userCollection 用户收藏
     * @return 用户收藏
     */
    @Override
    public List<UserCollection> selectUserCollectionList(UserCollection userCollection)
    {
        return userCollectionMapper.selectUserCollectionList(userCollection);
    }

    /**
     * 新增用户收藏
     * 
     * @param userCollection 用户收藏
     * @return 结果
     */
    @Override
    public int insertUserCollection(UserCollection userCollection)
    {
        userCollection.setCreateTime(DateUtils.getNowDate());
        return userCollectionMapper.insertUserCollection(userCollection);
    }

    /**
     * 修改用户收藏
     * 
     * @param userCollection 用户收藏
     * @return 结果
     */
    @Override
    public int updateUserCollection(UserCollection userCollection)
    {
        return userCollectionMapper.updateUserCollection(userCollection);
    }

    /**
     * 批量删除用户收藏
     * 
     * @param ids 需要删除的用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteUserCollectionByIds(Long[] ids)
    {
        return userCollectionMapper.deleteUserCollectionByIds(ids);
    }

    /**
     * 删除用户收藏信息
     * 
     * @param id 用户收藏主键
     * @return 结果
     */
    @Override
    public int deleteUserCollectionById(Long id)
    {
        return userCollectionMapper.deleteUserCollectionById(id);
    }
}
